<template>
  <div class="occupy-table">
    <el-table :data="tableData" class="jzt-table" stripe :style="setStyle">
      <el-table-column prop="date" label="采购商名称">
        <template #default="scope">
          <p class="text-over" :title="''">
            {{ scope.row?.businessName || "=" }}
          </p>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="规格">
        <template #default="scope">
          <div class="spe-wrap jzt-flex-center">
            <img :src="scope.row?.mainPicUrl" alt="" />
            <div class="right">
              <span>{{ scope.row?.code || "-" }}</span>
              <p class="text-break">{{ scope.row?.skuSpecification || "-" }}</p>
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="单位" width="180">
        <template #default="scope">
          <p>{{ useCodeArrStore().getDictName("shop_unit", scope.row.productUnit) || "-" }}</p>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="供应价" width="180">
        <template #default="scope">
          <p>{{ scope.row?.factoryRealPrice || "-" }}</p>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="占用数量" width="180">
        <template #default="scope">
          <p>{{ scope.row?.waitOccupyNum }}</p>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { ref } from "vue";
import useCodeArrStore from "@/store/modules/select";

const props = defineProps({
  tableData: {
    type: Array,
    default: () => []
  },
  setStyle: {
    type: Object,
    default: () => {
      return { width: "100%", "max-height": "500px", "overflow-y": "auto" };
    }
  }
});
</script>

<style lang="scss" scoped>
.spe-wrap {
  overflow-y: auto;
  justify-content: flex-start;
  img {
    width: 50px;
    height: 50px;
    margin-right: 10px;
  }
  .right {
    font-size: 12px;
    flex: 1;
    width: 0;
    span {
      color: #3d3d3d;
    }
    p {
      color: #86909c;
      line-height: 18px;
    }
  }
}
</style>
